<?php
session_start(); 
/*................................................................ 
 .  [E路联盟系统]                                          .
 .  版本: 2006A1.0                                                  . 
 .  原作: service (service@interlinkage.hk)                             .
 .  支持: http://www.16lm.com        .
................................................................*/
error_reporting(7);
require_once '../../includes/global.php';
//搜索下拉列表
$dcfg=Dga('dcfg',"id like '".$_GET[did]."'");
$dcfg=json_decode($dcfg[dcfg],true);

function buildsortnav($id,$table){
$navbit = " <a href=\"./sort.php?did=".$_GET['did']."&id=-1\">根分类</a>";
if($id!=-1)
{
$temp=Dga($table,"id ='".$id."'");
$zistr=explode(",",$temp[plist]);
$j=count($zistr);
	if($j>2)
	{   
	   for($i=1;$i<$j-1;$i++)
	   {
		$temp1=Dga($table,"id ='".$zistr[$i]."'");
		$navbit .= " / <a href=\"./sort.php?did=".$_GET['did']."&id=".$temp1[id]."\">".$temp1['title']."</a>";
	   }
	}
$navbit .= " / <a href=\"./sort.php?did=".$_GET['did']."&id=".$temp[id]."\">".$temp['title']."</a>";
}
 return $navbit;
}


    $temp=Dga($dcfg['name'],'1');
    if (empty($temp)) {
	echo "还没有任何分类！";
	exit;
    }

    if (empty($_GET[id])) {
        $_GET[id]="-1";
    }
	
        $extli = "<a href='l.php?did=".$_GET['did']."' ><font color=#ffffff>【EXT浏览】</font></a>";
 	Tr($extli,'extli');
  //  $listsort=listsort($_GET[id]);

$sortnav=buildsortnav($_GET[id],$dcfg['name']);
$ttt->assign("sortnav",$sortnav);
	
if(isset($_POST[offset]) and isset($_POST[pageline]))
{
$classtest = new tviewpage($prefix."_".$dcfg['name'],$_POST[pageline],$_POST[offset]);
//echo "Post";
}
elseif(isset($_GET[offset]) and isset($_GET[pageline]))
{
$classtest = new tviewpage($prefix."_".$dcfg['name'],$_GET[pageline],$_GET[offset]);
//echo "GET";
}
else
{

$offset=0;
$pageline=20;  
$classtest = new tviewpage($prefix."_".$dcfg['name'],$pageline,$offset);

//echo "none";
}

$classtest->setCondition(" where parentid=".$_GET[id]." and ( title like '%".$_GET['title']."%') and del !='1'  ORDER BY `id`  asc  ");

$classtest->setPageQuery('did',$_GET['did']);
$classtest->setPageQuery('id',$_GET[id]);
$classtest->setPageQuery('title',$_GET['title']);
$recordset = $classtest->getRecords();
ob_start();
$classtest->showFullFunc();
$nav = ob_get_contents();
ob_end_clean();
$ttt->assign("nav","$nav");


$j = count($recordset);
$content="";
for($i=0;$i<$j;$i++)
{	 $temp=Dga($dcfg['name'],"parentid='".$recordset[$i][id]."'");
$aml='';
	 if(!empty($temp))
	 {
	  $aml="  <a href=\"sort.php?did=".$_GET['did']."&id=".$recordset[$i][id]."\" title='浏览子分类'><font color=red ><b>_|_</b></font>   </a>";
	 }
	 $content.=" <tr>
      <td  height=\"25\"  bgColor=#ffffff>".$aml."".$recordset[$i]['title']."</td>
	  <td align=\"middle\" height=\"25\" bgColor=#ffffff>".$recordset[$i][id]."</td>
      <td align=\"middle\" width=\"235\" height=\"25\" bgColor=#ffffff>
	  【<a href=\"c.php?did=".$_GET['did']."&gid=".$recordset[$i]['gid']."\">编辑</a> 】|【<a href=\"d.php?did=".$_GET['did']."&id=".$recordset[$i][id]."\">删除</a>】|【<a href=\"c.php?did=".$_GET['did']."&dsid=".$recordset[$i][id]."\">添加子分类</a>】</td>
    </tr>"; 
		  }
$ttt->assign("content",$content);		  
Ts('mod/sort_list.htm');    

?>
